<template>
  <!-- 案件流转查询 -->
  <section class="page query-case-turn-record">
    <data-form :model="searchModel" @onSearch="refreshData" :page="pageService" >
      <template slot="inputs">
        <el-form-item label="借据号" prop="caseNumber">
          <el-input v-model="searchModel.caseNumber"></el-input>
        </el-form-item>
        <el-form-item label="案件类型" prop="turnSource">
        <el-select v-model="searchModel.turnSource" placeholder="请选择" clearable>
        <el-option v-for="{index,name,code} in $dict.getDictData('TurnSource')" :key="index" :label="name" :value="code"></el-option>
        </el-select>
       </el-form-item>      
        <el-form-item label="触发动作" prop="triggerAction">
        <el-select v-model="searchModel.triggerAction" placeholder="请选择" clearable>
         <el-option v-for="{index,name,code} in $dict.getDictData('TriggerAction')" :key="index" :label="name" :value="code"></el-option>
        </el-select>
       </el-form-item>
         <el-form-item label="触发时间" prop="caseTurnTime">
          <el-date-picker type="daterange" :editable="false" v-model="searchModel.caseTurnTime" placeholder="选择日期时间" clearable>
          </el-date-picker>
        </el-form-item>
        <el-form-item label="机构" prop="deptName">
          <el-cascader v-model="searchModel.deptName" :options="departmentData" :props="{value:'id',label:'deptName'}" change-on-select :show-all-levels="false" clearable></el-cascader>
        </el-form-item>
        <el-form-item label="催收员/受托方" prop="currentCollectorName">
          <el-input v-model="searchModel.currentCollectorName"></el-input>
        </el-form-item>
      </template>
    </data-form>

    <data-box :data="dataSet" @onPageChange="refreshData" :page="pageService">
        <template slot="columns">
        <!--数据列区域-->
        <el-table-column prop="caseNumber" label="借据号" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip></el-table-column>
            <el-table-column prop="personalName" label="客户姓名" :min-width="$helper.getColumnWidth(5)" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="mobileNo" label="电话" :formatter="(row)=>$filter.encryptPhone(row.mobileNo)" :min-width="$helper.getColumnWidth(5)" show-overflow-tooltip>
        </el-table-column>
                <el-table-column prop="idCard" label="身份证号码" :formatter="(row)=>$filter.encryptIDCardFour(row.idCard)" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="turnSource" label="案件类型" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
                <template slot-scope='scope'>
                    <span>{{scope.row.turnSource | dictConvert('TurnSource')}}</span>
                </template>
            </el-table-column>
            <el-table-column prop="triggerAction" label="触发动作" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
                <template slot-scope='scope'>
                    <span>{{scope.row.triggerAction | dictConvert('TriggerAction')}}</span>
                </template>
            </el-table-column>  
             <!-- <el-table-column prop="turnType" label="流转方式" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
                <template slot-scope='scope'>
                    <span>{{scope.row.turnType | dictConvert('TurnType')}}</span>
                </template>
            </el-table-column>  -->
              <el-table-column prop="caseTurnTime" label="触发时间" :formatter="(row) => $filter.dateTimeFormat(row.caseTurnTime)" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="deptName" label="机构" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
            </el-table-column>
             <el-table-column prop="currentCollectorName" label="催收员/受托方" :min-width="$helper.getColumnWidth(7)" show-overflow-tooltip>
            </el-table-column>         
        </template>
    </data-box>
  </section>
</template>

<script lang="ts">
import Vue from "vue";
import Component from "vue-class-component";
import { Auth, Layout, Dependencies } from "~/core/decorator";
import { PageService } from "~/utils/page.service";
import DataForm from "~/components/common/data-form.vue";
import DataBox from "~/components/common/data-box.vue";
import { SortService } from "~/utils/sort.service";
import NumberRange from "~/components/common/number-range.vue";
import { SynthesizeQueryService } from "~/services/domain-service/synthesize-query.service";
import { namespace, Getter, Mutation } from "vuex-class";

@Layout("workspace")
@Component({
  components: {
    DataForm,
    DataBox,
    NumberRange
  }
})
export default class QueryCaseTurnRecord extends Vue {
  @Dependencies(PageService) private pageService: PageService;
  @Dependencies(SortService) private sortService: SortService;
  @Dependencies(SynthesizeQueryService)
  private synthesizeQueryService: SynthesizeQueryService;
   @Getter private departmentData;

  private searchModel: any = {
    caseNumber: "",
    triggerAction: "",
    turnType: "",
    lastCollectorName: "",
    currentCollectorName: "",
    caseTurnTime: [],
    deptName:"",
    mobileNo:'',
  };

  private dataSet: any[] = [];

  private refreshData() {
    this.synthesizeQueryService
      .queryCaseTurnRecord(this.searchModel, this.pageService)
      .subscribe(data => (this.dataSet = data));
  }

  private mounted() {
    this.refreshData();
  }
}
</script>
<style lang="less">
</style>
